#include <bits/stdc++.h>
#include <type_traits>
using namespace std;

class Solution {
private:
vector<char> vec[10] = {
    {},
    {},
    {'a', 'b', 'c'},
    {'d', 'e', 'f'},
    {'g', 'h', 'i'},
    {'j', 'k', 'l'},
    {'m', 'n', 'o'},
    {'p', 'q', 'r', 's'},
    {'t', 'u', 'v'},
    {'w', 'x', 'y', 'z'}
};

void solve(string& digits, int idx, string str, vector<string>& ans){
    if(idx >= digits.length()) return;
    if(idx == digits.length()-1){
        for(auto& chr: vec[digits[idx]-'0']){
            ans.push_back(str+chr);
        }
        return;
    }
    for(auto& chr:vec[digits[idx]-'0']){
        solve(digits, idx+1, str+chr, ans);
    }
}

public:
    vector<string> letterCombinations(string digits) {
        vector<string> ans;
        string str;
        solve(digits, 0, str, ans);
        return ans;
    }
};

int main(){
    string s = "23";
    Solution solution;
    solution.letterCombinations(s);
    return 0;
}